<template>
	<view class="beijingse">
		<view class="" style="padding-bottom: 140rpx;">
			<!-- 待付款 -->
			<!-- 订单状态:1=待支付,2=待审核,3=待发货,4=待收货,5=已完成,6=已取消 -->
			<view class="mainpadding" style="background: #BA9549;" v-if="dataAll.state==1 || dataAll.state==7">
				<view class="flexbetween">
					<view class="flexleft">
						<image class="margin_right2" style="width: 46rpx;height: 46rpx;"
							src="../static/image/system/dfkb.png" mode=""></image>
						<view class="sanshier xiaobai">待付款</view>
					</view>
					<view class="flexright">
						<!-- <view class="margin_right1">
							<u-count-down :time="30 * 60 * 60 * 1000" format="HH:mm:ss"></u-count-down>
						</view> -->
						<view class="ershiba xiaobai">等待付款</view>
					</view>
				</view>
			</view>
			<view class="mainpadding" style="background: #BA9549;" v-if="dataAll.state==2">
				<view class="flexbetween">
					<view class="flexleft">
						<image class="margin_right2" style="width: 46rpx;height: 46rpx;"
							src="../static/image/system/dfkb.png" mode=""></image>
						<view class="sanshier xiaobai">待审核</view>
					</view>
					<view class="ershiba xiaobai">等待系统审核</view>
				</view>
			</view>
			<!-- 待发货 -->
			<view class="mainpadding" style="background: #BA9549;" v-if="dataAll.state==3">
				<view class="flexbetween">
					<view class="flexleft">
						<image class="margin_right2" style="width: 46rpx;height: 46rpx;"
							src="../static/image/system/dfhb.png" mode=""></image>
						<view class="sanshier xiaobai">待发货</view>
					</view>
					<view class="ershiba xiaobai">正在配货中</view>
				</view>
			</view>
			<!-- 待收货 -->
			<view class="mainpadding" style="background: #BA9549;" v-if="dataAll.state==4">
				<view class="flexbetween">
					<view class="flexleft">
						<image class="margin_right2" style="width: 46rpx;height: 46rpx;"
							src="../static/image/system/dshb.png" mode=""></image>
						<view class="sanshier xiaobai">待收货</view>
					</view>
					<view class="ershiba xiaobai">快递正在加速配送</view>
				</view>
			</view>
			<!-- 已完成 -->
			<view class="mainpadding" style="background: #BA9549;" v-if="dataAll.state==5">
				<view class="flexbetween">
					<view class="flexleft">
						<image class="margin_right2" style="width: 46rpx;height: 46rpx;"
							src="../static/image/system/ywcb.png" mode=""></image>
						<view class="sanshier xiaobai">已完成</view>
					</view>
					<view class="ershiba xiaobai">恭喜您，竞拍已完成</view>
				</view>
			</view>
			<!-- 已取消 -->
			<view class="mainpadding" style="background: #BA9549;" v-if="dataAll.state==6">
				<view class="flexbetween">
					<view class="flexleft">
						<image class="margin_right2" style="width: 46rpx;height: 46rpx;"
							src="../static/image/system/ywcb.png" mode=""></image>
						<view class="sanshier xiaobai">已取消</view>
					</view>
					<view class="ershiba xiaobai">订单已取消</view>
				</view>
			</view>
			<view class="mainpadding">
				<view class="mainpadding ffffff">
					<view class="xiahuaxian flexleft" style="align-items: flex-start;">
						<view class="margin_right2">
							<u-icon name="map-fill" color="#ba9549" size="28"></u-icon>
						</view>
						<view class="">
							<view class="ershiba">{{dataAll.addressinfo.address}}</view>
							<view class="flexleft margin_top2">
								<view class="ershiba xiaohui margin_right2">{{dataAll.addressinfo.name}}</view>
								<view class="ershiba xiaohui">{{dataAll.addressinfo.mobile}}</view>
							</view>
						</view>
					</view>
					<view class="flexleft margin_top xiahuaxian">
						<image style="min-width: 160rpx;width: 160rpx;height: 160rpx;" class="margin_right3"
							:src="dataAll.goods_image_text" mode=""></image>
						<view class="flexcolumn" style="width: 100%;justify-content: space-between;align-items: flex-start;height: 160rpx;">
							<view class="ershil xiaohei yhxk">{{dataAll.goods_name}}</view>
							<view class="ershil xiaohei yhxk">成交价：￥{{dataAll.goods_price}}</view>
							<view class="flexbetween">
								<view class="ershil xiaohui">
									<text class="margin_right0" v-show="dataAll.is_ky==1">空运 |</text>
									<text class="margin_right0" v-show="dataAll.is_pgfw==1">抛光 |</text>
									<text class="margin_right0" v-show="dataAll.is_fx==1">翻新 |</text>
									<text v-show="dataAll.is_xccl==1">瑕疵处理</text>
								</view>
								<view class="ershil xiaohei">x1</view>
							</view>
						</view>
					</view>
					<view class="xiahuaxian margin_top">
						<view class="flexbetween">
							<view class="ershil xiaohei">创建时间</view>
							<view class="ershil" style="color: #555555;">{{dataAll.createtime_text}}</view>
						</view>
						<view class="flexbetween margin_top">
							<view class="ershil xiaohei">订单编号</view>
							<view class="ershil" style="color: #555555;">{{dataAll.order_no}}</view>
						</view>
						<view class="flexbetween margin_top" v-if="dataAll.paymenttime_text">
							<view class="ershil xiaohei">付款时间</view>
							<view class="ershil" style="color: #555555;">{{dataAll.paymenttime_text}}</view>
						</view>
					</view>
					<view class="flexbetween margin_top">
						<view class="ershil xiaohei">商品小计</view>
						<view class="ershil" style="color: #555555;">￥{{dataAll.goods_price}}</view>
					</view>
					<view class="flexbetween margin_top">
						<view class="ershil xiaohei">快递费用</view>
						<view class="ershil" style="color: #555555;">到付</view>
					</view>
					<view class="flexbetween margin_top">
						<view class="ershil xiaohei">是否空运</view>
						<view class="ershil" style="color: #555555;">{{dataAll.is_ky==1?"是":"否"}}</view>
					</view>
					<view class="flexbetween margin_top" v-if="dataAll.is_pgfw==1">
						<view class="ershil xiaohei">抛光</view>
						<view class="ershil" style="color: #555555;">￥{{dataAll.pgfw_price}}</view>
					</view>
					<view class="flexbetween margin_top" v-if="dataAll.is_fx==1">
						<view class="ershil xiaohei">翻新</view>
						<view class="ershil" style="color: #555555;">￥{{dataAll.fx_price}}</view>
					</view>
					<view class="flexbetween margin_top" v-if="dataAll.is_xccl==1">
						<view class="ershil xiaohei">瑕疵处理</view>
						<view class="ershil" style="color: #555555;">￥{{dataAll.xccl_price}}</view>
					</view>
					<view class="flexbetween margin_top">
						<view class="ershil xiaohei">支付平台金额</view>
						<view class="ershil" style="color: #555555;">￥{{dataAll.pt_price}}</view>
					</view>
					<view class="flexbetween margin_top" v-if="dataAll.pay_type==1 || dataAll.pay_type==2 || dataAll.pay_type==3">
						<view class="ershil xiaohei">支付方式</view>
						<view class="ershil" style="color: #555555;">￥{{dataAll.pay_type==1?"微信支付":dataAll.pay_type==2?"支付宝支付":"银行卡支付"}}</view>
					</view>
					<view class="flexbetween margin_top">
						<view class="ershil xiaohei">增值费金额</view>
						<view class="ershil" style="color: #ff0000;">￥{{dataAll.pt_totalprice}}</view>
					</view>
					<view class="flexbetween margin_top">
						<view class="ershil xiaohei">实付金额</view>
						<view class="ershil" style="color: #ff0000;">￥{{dataAll.pay_price}}</view>
					</view>
					<view class="flexbetween margin_top" v-if="dataAll.state>=2 && dataAll.pay_image_text">
						<view class="ershil xiaohei">支付凭证</view>
						<image :src="dataAll.pay_image_text" @click="lbtpriview(0,[dataAll.pay_image_text])" style="width: 150rpx;height: 150rpx;" mode=""></image>
					</view>
				</view>
			</view>
		</view>
		<view class="gudingdb ffffff mainpadding flexbetween" v-if="dataAll.state==1 || dataAll.state==4 || dataAll.state==7">
			<view class="qxbtn flexcenter" v-if="dataAll.state==1" @click="cancelorder(listid)">取消订单</view>
			<view class="hxbtn flexcenter" v-if="dataAll.state==1" @click="pay(listid)">支付佣金</view>
			<!-- <view class="hxbtn flexcenter" style="width: 100%;" v-if="dataAll.state==7" @click="jumpdetail('/pages_paimai/shangczfpz?id=',listid)">上传凭证</view> -->
			<view class="hxbtn flexcenter" style="width: 100%;" v-if="dataAll.state==7" @click="uppingzheng(listid,dataAll.goods_id)">上传凭证</view>
			<view class="qxbtn flexcenter" v-if="dataAll.state==4" @click="chakanwl(dataAll.addressinfo.address)">查看物流</view>
			<view class="hxbtn flexcenter" v-if="dataAll.state==4" @click="shouhuo(listid)">确认收货</view>
		</view>
		<!-- 查看物流 -->
		<u-modal :show="ckwlModalshow" title="查看物流" confirmColor="#FF8505" confirmText="点击复制"
			:closeOnClickOverlay="true" @close="ckwlModalshow=false" @confirm="ckwlModalshow=false;copy(dataAll.express_name+dataAll.express_no)">
			<view class="slot-content flexcolumn mainpadding_top">
				<view class="">{{dataAll.express_name}}</view>
				<view class="margin_top">{{dataAll.express_no}}</view>
			</view>
		</u-modal>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				ckwlModalshow:false,
				listid:"",
				dataAll:{}
			}
		},
		onLoad(options) {
			this.listid = options.id
			
		},
		onShow() {
			this.getDetail()
		},
		methods: {
			uppingzheng(order_id,goods_id){
				uni.navigateTo({
					url:"/pages_homepage/jingpaixq?id="+goods_id+"&order_id="+order_id
				})
			},
			pay(order_id){
				uni.showLoading({
					mask: true,
					title: "请稍后"
				})
				let that = this
				httpRequest.request('/api/ordercl/payment', 'POST', {
					order_id
				}).then(res => {
					let data = res.data.wxconfig
					uni.hideLoading()
					if (res.code == 1) {
						uni.requestPayment({
							provider: 'wxpay',
							timeStamp: data.timeStamp,
							nonceStr: data.nonceStr,
							package: data.package,
							signType: data.signType,
							paySign: data.paySign,
							success: function(res) {
								// 支付成功
								that.getDetail()
							},
							fail: function(err) {
								// 取消支付
							}
						});
					}else{
						httpRequest.toast(res.msg)
					}
				})
			},
			chakanwl(val){
				uni.navigateTo({
					url:"/pages_mypage/wuliuxx?id="+this.dataAll.express_no+"&addr="+val
				})
			},
			getDetail(){
				httpRequest.request('/api/ordercl/orderDetail', 'GET', {
					id:this.listid
				}).then(res => {
					this.dataAll = res.data
				})
			},
			// 取消订单
			cancelorder(id) {
				httpRequest.modal('提示', '确认取消订单吗', true, (resp) => {
					if (resp) {
						httpRequest.request('/api/ordercl/cancelOrder', 'GET', {
							id: id,
						}).then(res => {
							httpRequest.toast(res.msg)
							if(res.code==1){
								this.getDetail()
							}
						})
					}
				})
			},
			shouhuo(id){
				httpRequest.modal('提示', '确认收到货了吗', true, (resp) => {
					if (resp) {
						httpRequest.request('/api/ordercl/confirmOrder', 'GET', {
							id: id,
						}).then(res => {
							httpRequest.toast(res.msg)
							if(res.code==1){
								this.getDetail()
							}
						})
					}
				})
			},
			// 跳转查看物流
			tzckwu() {
				uni.navigateTo({
					url: '/pages_mypage/chakanwlxx'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.hxbtn {
		width: 330rpx;
		height: 80rpx;
		background: #BA9549;
		font-weight: 400;
		font-size: 28rpx;
		color: #FFFFFF;
	}

	.qxbtnd {
		width: 100%;
		height: 80rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		border: 2rpx solid #DDDDDD;
		font-weight: 400;
		font-size: 28rpx;
		color: #222222;
		box-sizing: border-box;
	}

	.qxbtn {
		width: 330rpx;
		height: 80rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		border: 2rpx solid #DDDDDD;
		font-weight: 400;
		font-size: 28rpx;
		color: #222222;
		box-sizing: border-box;
	}

	/deep/.u-count-down__text {
		color: #FFFFFF !important;
	}
</style>